package com.fa4j.system.settings.model;


import com.fa4j.common.base.model.AbstractCmd;
import com.fa4j.common.base.model.CommonState;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.util.List;
import java.util.Map;

@Data
@Schema(description = "系统字典创建参数")
public class DictCreateCmd extends AbstractCmd {

    @NotBlank
    @Size(max = 64)
    @Schema(description = "字典名称")
    private String dictName;

    @NotBlank
    @Size(max = 64)
    @Schema(description = "字典编码")
    private String dictCode;

    @Size(max = 2048)
    @Schema(description = "字典值")
    private String dictValue;

    @NotNull
    @Schema(description = "状态")
    private CommonState state;

    @NotNull
    @Schema(description = "上级ID")
    private Integer parentId;

    @NotNull
    @Schema(description = "优先级")
    private Integer priority;

    @NotNull(groups = ValidRootDict.class)
    @Schema(description = "值类型")
    private DictValueType valueType;

    @NotNull(groups = ValidRootDict.class)
    @Positive
    @Schema(description = "最大层级")
    private Integer maxLevel;

    @Schema(description = "自定义字段")
    private List<DictCustomField> customFields;

    @Schema(description = "自定义值")
    private Map<String, Object> customData;

    public interface ValidRootDict {
    }

}
